// 源插件
import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import moment from 'moment';
import router from 'umi/router';

// 视图插件
import {
  Spin,
  Row,
  Col,
  Card,
  Form,
  Input,
  Select,
  Icon,
  Button,
  Dropdown,
  Menu,
  InputNumber,
  DatePicker,
  Modal,
  message,
  Badge,
  Divider,
  Steps,
  Radio,
  Upload,
} from 'antd';

// 外部组件
import StandardTable from '@/components/StandardTable';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

// css OR less预编译器
import styles from './RiskControl.less';

// 图片

/**
 *  Created by xjc on 2019/5/15
 *  Describe:数据连接
 */

@connect(({ risk, loading }) => ({
  risk,
  loading: loading.models.riskControlRule,
}))
@Form.create()
class RiskControl extends PureComponent {
  componentWillMount() {}

  /**
   *  Created by xjc on 2019/5/15
   *  Describe:当前状态
   */

  state = {
    listLoading: false, // 加载状态
    selectedRows: [], // 选择行
    formValues: {
      num: 10,
      page: 1,
    }, // 表格参数
    AuthorityAddVisible: false, // modal开关
    AuthorityDetailVisible: false, // modal开关
    AuthorityPermissionVisible: false, // modal开关
    EditORExamine: 'Edit', // 查看还是编辑
    record: {}, // 当前行内容
  };

  /**
   *  Created by xjc on 2019/5/15
   *  Describe:表头
   */
  columns = [
    {
      title: 'ID',
      dataIndex: 'id',
    },
    {
      title: '票据类型',
      colSpan: 2,
      dataIndex: 'tel',
      render: (value, row, index) => {
        const obj = {
          children: value,
          props: {},
        };
        if (index === 2) {
          obj.props.rowSpan = 2;
        }
        // These two are merged into above cell
        if (index === 3) {
          obj.props.rowSpan = 0;
        }
        if (index === 4) {
          obj.props.colSpan = 0;
        }
        return obj;
      },
    },
    {
      title: '股票名称',
      dataIndex: 'role',
    },
    {
      title: '成本价',
      dataIndex: 'role',
    },
    {
      title: '最新价',
      dataIndex: 'role',
    },
    {
      title: '数据(股)',
      dataIndex: 'role',
    },
    {
      title: '市值',
      dataIndex: 'role',
    },
    {
      title: '持仓比例',
      dataIndex: 'role',
    },
    {
      title: '盈亏',
      dataIndex: 'role',
    },
    {
      title: '盈亏比例',
      dataIndex: 'role',
    },
    {
      title: '财报日期',
      dataIndex: 'role',
    },
    {
      title: '票据到期日',
      dataIndex: 'role',
    },
    {
      title: '报警百分比',
      dataIndex: 'role',
    },
    {
      title: '对方赎回值',
      dataIndex: 'role',
    },
    {
      title: '事件备注',
      dataIndex: 'role',
    },
    {
      title: '风险等级标记',
      dataIndex: 'role',
    },
    {
      title: '行业集中站仓比',
      dataIndex: 'role',
    },
    {
      title: '操作时间',
      dataIndex: 'role',
    },
    {
      title: '所属行业',
      dataIndex: 'role',
    },
    {
      title: '个股新闻链接',
      dataIndex: 'role',
    },
    {
      title: '已经做了几单票据',
      dataIndex: 'role',
    },
  ];

  /**
   *  Created by xjc on 2019/5/15
   *  Describe:视图
   */

  render() {
    const { loading } = this.props;
    const { listLoading, selectedRows } = this.state;
    const listData = [];
    return (
      <PageHeaderWrapper title="票据风控">
        <Card bordered={false}>
          <StandardTable
            selectedRows={selectedRows}
            loading={listLoading}
            data={listData}
            columns={this.columns}
            // onChange={this.handleStandardTableChange}
            rowKey="id"
            scroll={{ x: 'auto' }}
          />
        </Card>
      </PageHeaderWrapper>
    );
  }

  componentDidMount() {
    const { dispatch } = this.props;

    /* 导入列表数据 */
  }

  componentWillUnmount() {}
}

export default RiskControl;
